package com.ape.mapsa.produccion.dao;

import java.util.List;

import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.ape.mapsa.produccion.model.InvRawMaterialsV;
import com.ape.mapsa.produccion.model.Item;

@Repository
public class MaterialsDAOImpl extends GenericDAOImpl<InvRawMaterialsV, Long> implements MaterialsDAO {

	@SuppressWarnings("unchecked")
	@Override
	public List<Item> getByQuery(String query) {
		return sessionFactory.getCurrentSession().createCriteria(Item.class)
				.add(Restrictions.like("descripcion", query, MatchMode.ANYWHERE).ignoreCase()).add(Restrictions.eq("itemCategoria","MMPP")).list();
	}

}
